package com.tian.mybatis.session;

import com.tian.mybatis.config.Configuration;
import com.tian.mybatis.config.XmlConfigBuilder;

import java.io.InputStream;

/**
 * @author tianwc  公众号：java后端技术全栈、面试专栏
 * @version 1.0.0
 * @date 2023年09月21日 16:39
 * 在线刷题 1200+题和1000+篇干货文章：<a href="https://woaijava.cc/">博客地址</a>
 */
public class SqlSessionFactoryBuilder {
    public SqlSessionFactory build(InputStream inputStream) throws Exception {
        Configuration configuration =new Configuration();
                //获取Configuration对象
        XmlConfigBuilder xmlConfigBuilder = new XmlConfigBuilder(configuration);
        xmlConfigBuilder.parse(inputStream);
        DefaultSqlSessionFactory sessionFactory = new DefaultSqlSessionFactory(configuration);
        return sessionFactory;
    }
}
